package com.cardone.platform.configuration.dao;

import java.util.List;
import java.util.Map;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import com.cardone.context.ContextHolder;
import com.cardone.persistent.support.JdbcTemplateSupport;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

/**
 * 配置
 *
 * @author yaohaitao
 *
 */
@Getter
@Setter
@Slf4j
public class ConfigurationJdbcDao implements ConfigurationDao {

	@Override
	public void resetSeq(final List<String> seqNameList) {
		for (final String seqName : seqNameList) {
			final Map<String, Object> model = Maps.newHashMap();

			model.put("seqName", seqName);

			try {
				ContextHolder.getBean(JdbcTemplateSupport.class).update(Lists.newArrayList(SqlIds.dropSeq.id(), SqlIds.createSeq.id()), model);
			} catch (final Exception e) {
				ConfigurationJdbcDao.log.error(e.getMessage(), e);
			}
		}
	}
}